#include <iostream>
using namespace std;

typedef unsigned long long ULL;

const int N=1e6+10, P=131;
ULL f[N], p[N];
string s;
int x;


int main()
{
	cin>>s>>x;
	s=" "+s;
	
	int n=s.size();
	p[0]=1;
	for(int i=1; i<=n; i++)
	{
		f[i]=f[i-1]*P+s[i];
		p[i]=p[i-1]*P;
	}
	
	while(x--)
	{
		int l1, r1, l2, r2;
		cin>>l1>>r1>>l2>>r2;
		
		ULL i=f[r1]-f[l1-1]*p[r1-l1+1];
		ULL j=f[r2]-f[l2-1]*p[r2-l2+1];
		
		if(i==j) cout<<"Yes"<<endl;
		else cout<<"No"<<endl;
	}
	
	return 0;
}
